home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 November / CPNL0711.ISO / boekhoud / finan / BADGER finance v1.0 beta 2.exe / xampplite / install / install.php < prev    next >
PHP Script  |  2005-12-05  |  22KB  |  718 lines

  1. <?php
  2.     /*
  3.     #### Installer PHP  1.5 ####
  4.     #### Author: Kay Vogelgesang & Carsten Wiedmann for www.apachefriends.org 2005 ####
  5.     */
  6.  
  7.     echo "\r\n  ########################################################################\n";
  8.     echo "  # ApacheFriends XAMPP Lite setup win32 Version 1.5                     #\r\n";
  9.     echo "  #----------------------------------------------------------------------#\r\n";
  10.     echo "  # Copyright (c) 2002-2005 Apachefriends                                #\r\n";
  11.     echo "  #----------------------------------------------------------------------#\r\n";
  12.     echo "  # Authors: Kay Vogelgesang <kvo@apachefriends.org>                     #\r\n";
  13.     echo "  #          Carsten Wiedmann <webmaster@wiedmann-online.de>             #\r\n";
  14.     echo "  ########################################################################\r\n\r\n";
  15.  
  16.     /// Where I stand? ///
  17.     $curdir = getcwd();
  18.     list($partition, $nonpartition) = split (':', $curdir); //Fix by Wiedmann
  19.     $partwampp = substr(realpath(__FILE__), 0, strrpos(dirname(realpath(__FILE__)), '\\'));
  20.     $directorwampp = NULL;
  21.     $awkpart = str_replace("&", "\\\\&", eregi_replace ("\\\\", "\\\\", $partwampp)); //Fix by Wiedmann
  22.     $awkpartslash = str_replace("&", "\\\\&", ereg_replace ("\\\\", "/", $partwampp)); //Fix by Wiedmann
  23.     $phpdir = $partwampp;
  24.     $dir = ereg_replace("\\\\", "/", $partwampp);
  25.     $ppartition = "$partition:";
  26.  
  27.     /// I need the install.sys + update.sys for more xampp informations
  28.     $installsys = "install.sys";
  29.     $installsysroot = $partwampp."\install\\".$installsys;
  30.  
  31.     /// Some addon|update.sys files
  32.     $perlupdatesys = "perlupdate.sys";
  33.     $pythonupdatesys = "pythonupdate.sys";
  34.     $serverupdatesys = "serverupdate.sys";
  35.     $utilsupdatesys = "utilsupdate.sys";
  36.     $javaupdatesys = "javaupdate.sys";
  37.     $otherupdatesys = "otherupdate.sys";
  38.  
  39.     /// XAMPP main directrory is ...
  40.     $substit = "\\\\\\\\xampplite";
  41.     $substitslash = "/xampplite";
  42.  
  43.     /// Globale variables
  44.     $BS = 0;
  45.     $CS = 0;
  46.     $slashi = 1;
  47.     $bslashi = 1;
  48.     $awkexe = ".\install\awk.exe";
  49.     $awk = ".\install\config.awk";
  50.     $awknewdir = "\"".$awkpart."\"";
  51.     $awkslashdir = "\"".$awkpartslash."\"";
  52.     if (file_exists("$partwampp\install\.version")) {
  53.         include_once "$partwampp\install\.version";
  54.     }
  55.     $confhttpdroot = $partwampp."\apache\\conf\\httpd.conf";
  56.  
  57.     // Find the install status for xampp basic package in the install.sys file
  58.     if (file_exists($installsysroot)) {
  59.         $i = 0;
  60.         $datei = fopen($installsysroot, 'r');
  61.         while (!feof($datei)) {
  62.             $zeile = fgets($datei, 255);
  63.             $sysroot[] = $zeile;
  64.             $i += 1;
  65.         }
  66.         fclose($datei);
  67.  
  68.         $sysroot[2] = str_replace('perl', 'server', $sysroot[2]); // Fix by Wiedmann
  69.         file_put_contents($installsysroot, implode('', $sysroot));
  70.  
  71.         list($left, $right) = split (' = ', $sysroot[0]);
  72.         $right = eregi_replace ("\r\n", "", $right);
  73.         if (strtolower($partwampp) == strtolower($right)) {
  74.             $xamppinstaller = "nothingtodo";
  75.         } else {
  76.             $xamppinstaller = "newpath";
  77.             $substit = eregi_replace ("\\\\", "\\\\\\\\", $right);
  78.             $substitslash = eregi_replace("\\\\", "/", $right);
  79.         }
  80.     } else {
  81.         $installsys = fopen($installsysroot, 'w');
  82.         $wamppinfo = "DIR = $partwampp\r\nxampp = $xamppversion\r\nserver = 0\r\nperl = 0\r\npython = 0\r\nutils = 0\r\njava = 0\r\nother = 0";
  83.         fputs($installsys, $wamppinfo);
  84.         fclose($installsys);
  85.         $xamppinstaller = "newinstall";
  86.     }
  87.  
  88.     /// Find some *update.sys files and modify the install.sys ...
  89.     $path = $partwampp."\install\\";
  90.     $hdl = opendir($path);
  91.     while ($res = readdir($hdl)) { //Searching all xampp sys files
  92.         $array[] = $res;
  93.      }
  94.     closedir($hdl);
  95.     $werte = count($array);
  96.     for ($q = 2; $q < $werte; $q++) {
  97.         if (($array[$q] == $perlupdatesys) || ($array[$q] == $pythonupdatesys) || ($array[$q] == $serverupdatesys) || ($array[$q] == $utilsupdatesys) || ($array[$q] == $javaupdatesys) || ($array[$q] == $otherupdatesys)) {
  98.             $updatesysroot = $partwampp."\install\\".$array[$q];
  99.             if (file_exists($updatesysroot)) {
  100.                 $datei = fopen($updatesysroot, 'r');
  101.                 unset($updatezeile);
  102.  
  103.                 $i = 0;
  104.                 while (!feof($datei)) {
  105.                     $zeile = fgets($datei, 255);
  106.                     $updatezeile[] = $zeile;
  107.                     @list($left, $right) = split('=', $updatezeile[0]);
  108.                     $left = eregi_replace(" ", "", $left);
  109.                     $left = eregi_replace("\r\n", "", $left);
  110.                     $right = eregi_replace("\r\n", "", $right);
  111.                     $update = $left;
  112.                     $update = strtolower($update);
  113.                     $updateversion = trim($right);
  114.                     $updateversionzahl = preg_split('|[.-]|', $updateversion); // Fix by Wiedmann
  115.                     if (!isset($updateversionzahl[3])) {
  116.                         $updateversionzahl[3] = '';
  117.                     }
  118.                     $updateinc = "xampp".$update.".inc";
  119.                     $updateconf = $update.".conf";
  120.                     echo "  Configure for $update $updateversion\r\n";
  121.                     $i++;
  122.                 }
  123.                 fclose($datei);
  124.  
  125.                 if (file_exists($installsysroot)) {
  126.                     $datei = fopen($installsysroot, 'r');
  127.                     unset($newzeile);
  128.                     $i = 0;
  129.                     while (!feof($datei)) {
  130.                         $zeile = fgets($datei, 255);
  131.                         $newzeile[] = $zeile;
  132.                         $i++;
  133.                     }
  134.                     fclose($datei);
  135.  
  136.                     /// Analyze install.sys to *update.syse for todo
  137.                     $datei = fopen($installsysroot, 'w');
  138.                     if ($datei) {
  139.                         for ($z = 0; $z < $i + 1; $z++) {
  140.                             if (0 === stripos(trim($newzeile[$z]), trim($update))) { // Fix by Wiedmann
  141.                                 list($left, $right) = split ('=', $newzeile[$z]);
  142.                                 $left = eregi_replace(" ", "", $left);
  143.                                 $left = eregi_replace("\r\n", "", $left);
  144.                                 $right = trim(eregi_replace("\r\n", "", $right));
  145.                                 $currentversionzahl = preg_split('|[.-]|', $right);; // Fix by Wiedmann
  146.                                 if (!isset($currentversionzahl[3])) {
  147.                                     $currentversionzahl[3] = '';
  148.                                 }
  149.                                 if ($currentversionzahl == 0 ) {
  150.                                     $updatemake = "makenew"; // New installation
  151.                                     $putnew = "$update = $updateversion\r\n";
  152.                                     fputs($datei, $putnew);
  153.                                 } elseif (
  154.                                         (array_sum($currentversionzahl) < array_sum($updateversionzahl)) ||
  155.                                         ((array_sum($currentversionzahl) == array_sum($updateversionzahl)) &&
  156.                                         ($currentversionzahl[3] != $updateversionzahl[3]))) {
  157.                                     $updatemake = "update";  // Update installation
  158.                                     $putnew = "$update = $updateversion\r\n"; // Fix by Wiedmann
  159.                                     fputs($datei, $putnew);
  160.                                 } else {
  161.                                     $updatemake = "doppelt"; // Installation is current
  162.                                     fputs($datei, $newzeile[$z]);
  163.                                 }
  164.                             } else {
  165.                                 fputs($datei, $newzeile[$z]);
  166.                             }
  167.                         }
  168.                     }
  169.                     fclose($datei);
  170.  
  171.                     if (($updatemake == "makenew") || ($updatemake=="doppelt")) {
  172.                         include_once "$partwampp\install\\$updateinc";
  173.                     }
  174.                 }
  175.                 // httpd.conf modification for Perl, Python or Java (only single)
  176.                 if ($update == "perl") {
  177.                     $includehttpdconf = "\r\n\r\nInclude conf/perl.conf";
  178.                 }
  179.                 if ($update == "python") {
  180.                     $includehttpdconf = "\r\n\r\nInclude conf/python.conf";
  181.                 }
  182.                 if ($update == "java") {
  183.                     $includehttpdconf = "\r\n\r\nInclude conf/java.conf";
  184.                 }
  185.                 if ((($update == "perl") || ($update == "python") || ($update == "java")) && ($updatemake == "makenew")) {
  186.                     $datei = fopen($confhttpdroot, 'a');
  187.                     if ($datei) {
  188.                         fputs($datei, $includehttpdconf);
  189.                     }
  190.                     @fclose($datei);
  191.                     $datei = fopen($confhttpd2root, 'a');
  192.                     if ($datei) {
  193.                         fputs($datei, $includehttpdconf);
  194.                     }
  195.                     fclose($datei);
  196.                     $datei = fopen($confhttpd3root, 'a');
  197.                     if ($datei) {
  198.                         fputs($datei, $includehttpdconf);
  199.                     }
  200.                     fclose($datei);
  201.                 }
  202.  
  203.                 unlink($updatesysroot);
  204.             }
  205.         }
  206.     }
  207.  
  208.     if (($xamppinstaller == "newinstall") || ($xamppinstaller == "newpath")) {
  209.         if ($xamppinstaller == "newinstall") {
  210.             /// First initialization only main packages
  211.             if (file_exists("$partwampp\install\\xamppbasic.inc")) {
  212.                 include_once "$partwampp\install\\xamppbasic.inc";
  213.             }
  214.             if (file_exists("$partwampp\install\\xamppserver.inc")) { // Fix by Wiedmann
  215.                 include_once "$partwampp\install\\xamppserver.inc";
  216.             }
  217.         } else {
  218.             /// Find all the packages
  219.             if (file_exists("$partwampp\install\\xamppbasic.inc")) {
  220.                 include_once "$partwampp\install\\xamppbasic.inc";
  221.             }
  222.             if (file_exists("$partwampp\install\\xamppserver.inc")) {
  223.                 include_once "$partwampp\install\\xamppserver.inc";
  224.             }
  225.             if (file_exists("$partwampp\install\\xamppperl.inc")) {
  226.                 include_once "$partwampp\install\\xamppperl.inc";
  227.             }
  228.             if (file_exists("$partwampp\install\\xampppython.inc")) {
  229.                 include_once "$partwampp\install\\xampppython.inc";
  230.             }
  231.             if (file_exists("$partwampp\install\\xampputils.inc")) {
  232.                 include_once "$partwampp\install\\xampputils.inc";
  233.             }
  234.             if (file_exists("$partwampp\install\\xamppjava.inc")) {
  235.                 include_once "$partwampp\install\\xamppjava.inc";
  236.             }
  237.             if (file_exists("$partwampp\install\\xamppother.inc")) {
  238.                 include_once "$partwampp\install\\xamppother.inc";
  239.             }
  240.             $updatemake = "nothingtodo";
  241.         }
  242.     }
  243.  
  244.     $scount = count($slashrootreal);
  245.     $bcount = count($backslashrootreal);
  246.  
  247.     /////////////////// xampp path is changing ///////////////////
  248.     if ($xamppinstaller == "newpath") {
  249.         set_time_limit(0);
  250.         define('NEWSTDIN', fopen("php://stdin", "r")); // Fix by Wiedmann
  251.         while ($BS == "0") {
  252.             echo "\n  Do you want to refresh the XAMPP installation?\n";
  253.             echo "  Soll die XAMPP Installation jetzt aktualisiert werden?\n\n";
  254.             echo "  1) Refresh now! (Jetzt aktualisieren!)\n";
  255.             echo "  x) Exit (Beenden)\n";
  256.  
  257.             switch (trim(fgets(NEWSTDIN, 256))) { // Fix by Wiedmann
  258.                 case 1:
  259.                     $BS = 1;
  260.                     echo "\r\n  XAMPP is refreshing now ...\r\n";
  261.                     echo "  XAMPP wird nun aktualisiert ...\r\n\r\n";
  262.                     sleep(1);
  263.                     break;
  264.  
  265.                 case "x":
  266.                     echo "\r\n  The refresh is terminating on demand ...  exit\r\n";
  267.                     echo "  Die Aktualisierung wurde auf Wunsch abgebrochen ...\r\n";
  268.                     sleep(3);
  269.                     exit;
  270.  
  271.                 default:
  272.                     exit;
  273.             }
  274.         }
  275.         fclose(NEWSTDIN); // Fix by Wiedmann
  276.     }
  277.  
  278.     /////////////////// You can configure the addon modules for httpd ///////////////////
  279.     if (file_exists($installsysroot)) {
  280.         $datei = fopen($installsysroot, 'r');
  281.         unset($newzeile);
  282.         $i = 0;
  283.         while (!feof($datei)) {
  284.             $zeile = fgets($datei, 255);
  285.             @list($left, $right) = split ('=', $zeile);
  286.             $left = eregi_replace(" ", "", $left);
  287.             $left = eregi_replace("\r\n", "", $left);
  288.             $right = eregi_replace("\r\n", "", $right);
  289.             $right = eregi_replace("\.", "", $right);
  290.             if (strtolower($right) > 0) {
  291.                 if (strtolower($left) == "perl") {
  292.                     $perlactive = "yes";
  293.                 }
  294.                 if (strtolower($left) == "python") {
  295.                     $pythonactive = "yes";
  296.                 }
  297.                 if (strtolower($left) == "java") {
  298.                     $javaactive = "yes";
  299.                 }
  300.             }
  301.         }
  302.         fclose($datei);
  303.     }
  304.  
  305.     /////////////////// Case new install ///////////////////
  306.     if (($xamppinstaller == "newinstall") || ($BS == 1) || ($updatemake == "makenew") || ($updatemake == "doppelt")) {
  307.         if ($BS == "1") {
  308.             echo "  Refreshing all paths in config files ... \r\n\r\n";
  309.         }
  310.  
  311.         echo "  Configure XAMPP with awk for ";
  312.         $system = system("echo '%os%'");
  313.         if ($system != "'Windows_NT'") {
  314.             $system = "Windows";
  315.             echo "  $system 98/ME/HOME (not NT)";
  316.         }
  317.         echo "  Please wait ...";
  318.         if ($xamppinstaller == "newinstall") {
  319.             if ($system == "Windows") {
  320.                 $confhttpdroot = $partwampp."\apache\\conf\\httpd.conf";
  321.                 $includewin = "Win32DisableAcceptEx\r\n";
  322.                 echo "\r\n  Disable AcceptEx Winsocks v2 support (only NT)";
  323.                 $datei = fopen($confhttpdroot, 'r');
  324.                 unset($newzeile);
  325.                 $i = 0;
  326.                 while (!feof($datei)) {
  327.                     $zeile = fgets($datei, 255);
  328.                     $newzeile[] = $zeile;
  329.                     $i++;
  330.                 }
  331.                 fclose($datei);
  332.                 $datei = fopen($confhttpdroot, 'w');
  333.                 if ($datei) {
  334.                     for ($z = 0; $z < $i + 1; $z++) {
  335.                         if (eregi("Win32DisableAcceptEx", $newzeile[$z])) {
  336.                             fputs($datei, $includewin);
  337.                         } else {
  338.                             fputs($datei, $newzeile[$z]);
  339.                         }
  340.                     }
  341.                 }
  342.                 fclose($datei);
  343.             } else {
  344.                 $confhttpdroot = $partwampp."\apache\\conf\\httpd.conf";
  345.                 $includewin = "# Win32DisableAcceptEx\r\n";
  346.                 echo "\r\n  Enable AcceptEx Winsocks v2 support for NT systems";
  347.                 $datei = fopen($confhttpdroot, 'r');
  348.                 $i = 0;
  349.                 unset($newzeile);
  350.                 while (!feof($datei)) {
  351.                     $zeile = fgets($datei, 255);
  352.                     $newzeile[] = $zeile;
  353.                     $i++;
  354.                 }
  355.                 fclose($datei);
  356.                 $datei = fopen($confhttpdroot, 'w');
  357.                 if ($datei) {
  358.                     for ($z = 0; $z < $i + 1; $z++) {
  359.                         if (eregi("Win32DisableAcceptEx", $newzeile[$z])) {
  360.                             fputs($datei, $includewin);
  361.                         } else {
  362.                             fputs($datei, $newzeile[$z]);
  363.                         }
  364.                     }
  365.                 }
  366.                 fclose($datei);
  367.             }
  368.         }
  369.  
  370.         $substit = "\"".$substit."\"";
  371.         $trans = array(
  372.             "^" => "\\\\^",
  373.             "." => "\\\\.",
  374.             "[" => "\\\\[",
  375.             "$" => "\\\\$",
  376.             "(" => "\\\\(",
  377.             ")" => "\\\\)",
  378.             "+" => "\\\\+",
  379.             "{" => "\\\\{"
  380.         );
  381.         $substit = strtr($substit, $trans);
  382.         for ($i = 0; $i <= $bcount; $i++) {
  383.             ///// 08.08.05 Vogelgesang: For all files with identical file names /////
  384.             if ($backslash[$i] == "") {
  385.                 $upbackslashrootreal = $backslashrootreal[$i];
  386.             } else {
  387.                 $configname = $backslash[$i];
  388.                 $upbackslashrootreal = $backslashrootreal[$configname].$configname;
  389.  
  390.             }
  391.             $backslashawk = eregi_replace("\\\\", "\\\\", $upbackslashrootreal);
  392.             $backslashawk = "\"".$backslashawk;
  393.  
  394.             $awkconfig = $backslashawk."\"";
  395.             $awkconfigtemp = $backslashawk."temp\"";
  396.             $configreal = $upbackslashrootreal;
  397.             $configtemp = $upbackslashrootreal."temp";
  398.  
  399.             ///////////// Section SET  NEW configfiles for addons/update OR DELETE /////////////
  400.             $configrealnew = $upbackslashrootreal.".new";
  401.             if (!file_exists($configreal) && file_exists($configrealnew)) {
  402.                 if (!@copy($configrealnew, $configreal)) {
  403.                 } else {
  404.                     unlink($configrealnew);
  405.                 }
  406.             } elseif (file_exists($configrealnew)) {
  407.                 unlink($configrealnew);
  408.             }
  409.  
  410.             if ($updatemake == "doppelt") {
  411.                 break;
  412.             }
  413.  
  414.             $awkrealm = $awkexe." -v DIR=".$awknewdir." -v CONFIG=".$awkconfig. " -v CONFIGNEW=".$awkconfigtemp. "  -v SUBSTIT=".$substit." -f ".$awk;
  415.  
  416.             if (file_exists($awk) && file_exists($awkexe) && file_exists($configreal)) {
  417.                 $handle = popen($awkrealm, 'w'); // Fix by Wiedmann
  418.                 pclose($handle);
  419.             }
  420.  
  421.             if (file_exists($configtemp) && file_exists($configreal)) {
  422.                 if (!@copy($configtemp, $configreal)) {
  423.                 } else {
  424.                     unlink($configtemp);
  425.                 }
  426.             }
  427.         }
  428.  
  429.         $substitslash = "\"".$substitslash."\"";
  430.         $trans = array(
  431.             "^" => "\\\\^",
  432.             "." => "\\\\.",
  433.             "[" => "\\\\[",
  434.             "$" => "\\\\$",
  435.             "(" => "\\\\(",
  436.             ")" => "\\\\)",
  437.             "+" => "\\\\+",
  438.             "{" => "\\\\{"
  439.         );
  440.         $substitslash = strtr($substitslash, $trans);
  441.         for ($i = 0; $i <= $scount; $i++) {
  442.             ///// 08.08.05 Vogelgesang: For all files with identical file names /////
  443.             if ($slash[$i] == "") {
  444.                 $upslashrootreal = $slashrootreal[$i];
  445.             } else {
  446.                 $configname = $slash[$i];
  447.                 $upslashrootreal = $slashrootreal[$configname].$configname;
  448.             }
  449.             $slashawk = eregi_replace("\\\\", "\\\\", $upslashrootreal);
  450.             $slashawk = "\"".$slashawk;
  451.             $awkconfig = $slashawk."\"";
  452.             $awkconfigtemp = $slashawk."temp\"";
  453.             $configreal = $upslashrootreal;
  454.             $configtemp=$upslashrootreal."temp";
  455.  
  456.             ///////////// Section SET  NEW configfiles for addons/update OR DELETE /////////////
  457.             $configrealnew = $upslashrootreal.".new";
  458.             if (!file_exists($configreal) && file_exists($configrealnew)) {
  459.                 if (!@copy($configrealnew, $configreal)) {
  460.                 } else {
  461.                     unlink($configrealnew);
  462.                 }
  463.             } elseif (file_exists($configrealnew)) {
  464.                 unlink($configrealnew);
  465.             }
  466.  
  467.             if ($updatemake == "doppelt") {
  468.                 break;
  469.             }
  470.  
  471.             $awkrealm = $awkexe." -v DIR=".$awkslashdir." -v CONFIG=".$awkconfig. " -v CONFIGNEW=".$awkconfigtemp. "  -v SUBSTIT=".$substitslash." -f ".$awk;
  472.  
  473.             if (file_exists($awk) && file_exists($awkexe) && file_exists($configreal)) {
  474.                 $handle = popen($awkrealm, 'w'); // Fix by Wiedmann
  475.                 pclose($handle);
  476.             }
  477.  
  478.             if (file_exists($configtemp) && file_exists($configreal)) {
  479.                 if (!@copy($configtemp, $configreal)) {
  480.                 } else {
  481.                     unlink($configtemp);
  482.                 }
  483.             }
  484.         }
  485.  
  486.         if (($xamppinstaller == "newpath") || ($BS == 1)) {
  487.             if (file_exists($installsysroot)) {
  488.                 $datei = fopen($installsysroot, 'r');
  489.                 unset($newzeile);
  490.                 $i = 0;
  491.                 while (!feof($datei)) {
  492.                     $zeile = fgets($datei, 255);
  493.                     $newzeile[] = $zeile;
  494.                     $i++;
  495.                 }
  496.                 fclose($datei);
  497.             }
  498.  
  499.             $datei = fopen($installsysroot, 'w');
  500.             if ($datei) {
  501.                 for ($z = 0; $z < $i + 1; $z++) {
  502.                     if (eregi("DIR", $newzeile[$z])) {
  503.                         $includenewdir = "DIR = $partwampp\r\n";
  504.                         fputs($datei, $includenewdir);
  505.                     } else {
  506.                         $includenewdir = $newzeile[$z];
  507.                         fputs($datei, $includenewdir);
  508.                     }
  509.                 }
  510.             }
  511.             fclose($datei);
  512.         }
  513.  
  514.         ////////// Replace (copy) some newer files ////////////////
  515.         $phpbin = $partwampp."\\apache\\bin\\php.ini";
  516.         $phpcgi = $partwampp."\\php\\php.ini";
  517.         @copy($phpbin, $phpcgi);
  518.  
  519.         $workersbin = $partwampp."\\tomcat\\conf\\workers.properties";
  520.         $workersjk = $partwampp."\\tomcat\\conf\\jk\\workers.properties";
  521.         if (file_exists($workersbin)) {
  522.             copy($workersbin,$workersjk);
  523.         }
  524.  
  525.         echo "  DONE!\r\n\r\n";
  526.         echo "\r\n  ##### Have fun with ApacheFriends XAMPP Lite! #####\r\n\r\n\r\n";
  527.         sleep(3);
  528.     }
  529.  
  530.     //////////////// Selection for modules  ////////////////
  531.     if ((($perlactive == "yes") || ($pythonactive == "yes") || ($javaactive == "yes")) && ($update == "")) {
  532.         $u = 1;
  533.  
  534.         if ($perlactive == "yes") {
  535.             $moduleconf = "conf/perl.conf";
  536.             $moduleconfigure = "MOD_PERL";
  537.             $u++;
  538.         }
  539.         if ($pythonactive == "yes") {
  540.             $moduleconf = "conf/pyton.conf";
  541.             $moduleconfigure = "MOD_PYTHON";
  542.             $u++;
  543.         }
  544.         if ($javaactive == "yes") {
  545.             $moduleconf = "conf/java.conf";
  546.             $moduleconfigure = "MOD_JDK";
  547.             $u++;
  548.         }
  549.  
  550.         set_time_limit(0);
  551.         define('NEWSTDIN', fopen("php://stdin", "r"));
  552.         while ($CS == "0") {
  553.             echo "\n  Please select your choice!\n";
  554.             echo "  Bitte jetzt auswaehlen!\n\n";
  555.             if ($perlactive == "yes") {
  556.                 echo "  1) Configuration with MOD_PERL (mit MOD_PERL)\n";
  557.                 echo "  2) Configuration without MOD_PERL (ohne MOD MOD_PERL)\n";
  558.             }
  559.             if ($pythonactive == "yes") {
  560.                 echo "  3) Configuration with MOD_PYTHON (mit MOD_PYTHON)\n";
  561.                 echo "  4) Configuration without MOD_PYTHON (ohne MOD_PYTHON)\n";
  562.             }
  563.             if ($javaactive == "yes") {
  564.                 echo "  5) Configuration with MOD_JDK (mit MOD_JDK)\n";
  565.                 echo "  6) Configuration without MOD_JDK (ohne MOD_JDK)\n";
  566.             }
  567.             echo "  x) Exit (Beenden)\n";
  568.  
  569.             switch (trim(fgets(NEWSTDIN, 256))) {
  570.                 case 1:
  571.                     $CS = 1;
  572.                     echo "\r\n  Starting configure XAMPP with MOD_PERL ...\r\n";
  573.                     sleep(1);
  574.                     break;
  575.  
  576.                 case 2:
  577.                     $CS = 2;
  578.                     echo "\r\n  Starting configure XAMPP without MOD_PERL ...\r\n";
  579.                     sleep(1);
  580.                     break;
  581.  
  582.                 case 3:
  583.                     $CS = 3;
  584.                     echo "\r\n  Starting configure XAMPP with MOD_PYTHON ...\r\n";
  585.                     sleep(1);
  586.                     break;
  587.  
  588.                 case 4:
  589.                     $CS = 4;
  590.                     echo "\r\n  Starting configure XAMPP without MOD_PYTHON ...\r\n";
  591.                     sleep(1);
  592.                     break;
  593.  
  594.                 case 5:
  595.                     $CS = 5;
  596.                     echo "\r\n  Starting configure XAMPP with MOD_JDK ...\r\n";
  597.                     sleep(1);
  598.                     break;
  599.  
  600.                 case 6:
  601.                 $CS = 6;
  602.                 echo "\r\n  Starting configure XAMPP without MOD_JDK ...\r\n";
  603.                 sleep(1);
  604.                 break;
  605.  
  606.                 case "x":
  607.                     echo "\r\n  Setup is terminating on demand ...  exit\r\n";
  608.                     echo "  Das Setup wurde auf Wunsch abgebrochen ...\r\n";
  609.                     sleep(3);
  610.                     exit;
  611.  
  612.                 default:
  613.                     exit;
  614.             }
  615.         }
  616.         fclose(NEWSTDIN);
  617.  
  618.         if ($CS == 1) {
  619.             $include = "Include conf/perl.conf"; $searchstring="conf/perl.conf";
  620.         }
  621.         if ($CS == 2) {
  622.             $include = "# Include conf/perl.conf"; $searchstring="conf/perl.conf";
  623.         }
  624.         if ($CS == 3) {
  625.             $include = "Include conf/python.conf"; $searchstring="conf/python.conf";
  626.         }
  627.         if ($CS == 4) {
  628.             $include = "# Include conf/python.conf"; $searchstring="conf/python.conf";
  629.         }
  630.         if ($CS == 5) {
  631.             $include = "Include conf/java.conf"; $searchstring="conf/java.conf";
  632.         }
  633.         if ($CS == 6) {
  634.             $include = "# Include conf/java.conf"; $searchstring="conf/java.conf";
  635.         }
  636.  
  637.         if ($CS > 0) {
  638.             $i = 0;
  639.             $datei = fopen($confhttpdroot, 'r');
  640.             while (!feof($datei)) {
  641.                 $zeile = fgets($datei, 255);
  642.                 $newzeile[] = $zeile;
  643.                 $i++;
  644.             }
  645.             fclose($datei);
  646.             $datei = fopen($confhttpdroot, 'w');
  647.             if ($datei) {
  648.                 for ($z = 0; $z < $i + 1; $z++) {
  649.                     if (eregi($searchstring, $newzeile[$z])) {
  650.                         fputs($datei, $include);
  651.                     } else {
  652.                         fputs($datei, $newzeile[$z]);
  653.                     }
  654.                 }
  655.             }
  656.             fclose($datei);
  657.             unset($newzeile);
  658.             $i = 0;
  659.             $datei = fopen($confhttpd2root, 'r');
  660.             while (!feof($datei)) {
  661.                 $zeile = fgets($datei, 255);
  662.                 $newzeile[] = $zeile;
  663.                 $i++;
  664.             }
  665.             fclose($datei);
  666.             $datei = fopen($confhttpd2root, 'w');
  667.             if ($datei) {
  668.                 for($z = 0; $z < $i + 1; $z++) {
  669.                     if (eregi($searchstring, $newzeile[$z])) {
  670.                         fputs($datei, $include);
  671.                     } else {
  672.                         fputs($datei, $newzeile[$z]);
  673.                     }
  674.                 }
  675.             }
  676.             fclose($datei);
  677.             unset($newzeile);
  678.             $i = 0;
  679.             $datei = fopen($confhttpd3root, 'r');
  680.             while (!feof($datei)) {
  681.                 $zeile = fgets($datei, 255);
  682.                 $newzeile[] = $zeile;
  683.                 $i++;
  684.             }
  685.             fclose($datei);
  686.             $datei = fopen($confhttpd3root, 'w');
  687.             if ($datei) {
  688.                 for ($z = 0; $z < $i + 1; $z++) {
  689.                     if (eregi($searchstring, $newzeile[$z])) {
  690.                         fputs($datei, $include);
  691.                     } else {
  692.                         fputs($datei, $newzeile[$z]);
  693.                     }
  694.                 }
  695.             }
  696.             fclose($datei);
  697.             unset($newzeile);
  698.             echo "  Done!\r\n\r\n";
  699.         }
  700.     }
  701.  
  702.     if (file_exists($partwampp.'\install\serverupdate.inc')) { // Fix by Wiedmann
  703.         include $partwampp.'\install\serverupdate.inc';
  704.         unlink($partwampp.'\install\serverupdate.inc');
  705.         echo "\r\n".'Ready.'."\r\n";
  706.     }
  707.  
  708.     if ($updatemake == "") {
  709.         $updatemake="nothingtodo";
  710.     }
  711.  
  712.     if (($updatemake == "nothingtodo") && ($xamppinstaller == "nothingtodo") && (($CS < 1) || ($CS == ""))) {
  713.         echo "\r\n\r\n Sorry, but ... nothing to do!\r\n\r\n\r\n";
  714.     }
  715.  
  716.     exit;
  717. ?>
  718.